<?php

namespace App\Http\Middleware;

use Closure;
use DB;
class openMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $open = DB::table('config')
            ->first()->open;
        if($open==0){
            return redirect('404');
        }
        return $next($request);
    }
}
